package com.jinzecloud.reportapproval.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.jinzecloud.reportapproval.bean.ReportCondition;
import com.jinzecloud.reportapproval.dto.Param;
import com.jinzecloud.reportapproval.service.ReportConditionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.jinzecloud.reportapproval.utils.PageUtils;
import com.jinzecloud.reportapproval.utils.R;



/**
 * 试验条件
 *
 * @author æ­å°
 * @email 1971240051@qq.com
 * @date 2024-09-03 12:10:45
 */
@RestController
@RequestMapping("reportApproval/reportcondition")
@Api(tags = "试验条件", description = "试验条件", value = "试验条件")
public class ReportConditionController {
    @Autowired
    private ReportConditionService reportConditionService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    @ApiOperation(value = "试验条件列表",notes = "试验条件列表")
    //@RequiresPermissions("reportApproval:reportcondition:list")
    public R list(@RequestBody Param param){
        PageUtils page = reportConditionService.queryPage(param);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping(value = "/info/{id}",method = RequestMethod.POST)
    @ApiOperation(value = "试验条件信息",notes = "试验条件信息")
    //@RequiresPermissions("reportApproval:reportcondition:info")
    public R info(@PathVariable("id") Integer id){
		ReportCondition reportCondition = reportConditionService.getById(id);

        return R.ok().put("reportCondition", reportCondition);
    }

    /**
     * 保存
     */
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ApiOperation(value = "试验条件保存",notes = "试验条件保存")
    //@RequiresPermissions("reportApproval:reportcondition:save")
    public R save(@RequestBody ReportCondition reportCondition){
		reportConditionService.save(reportCondition);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    @ApiOperation(value = "试验条件修改",notes = "试验条件修改")
    //@RequiresPermissions("reportApproval:reportcondition:update")
    public R update(@RequestBody ReportCondition reportCondition){
		reportConditionService.updateById(reportCondition);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    @ApiOperation(value = "试验条件删除",notes = "试验条件删除")
    //@RequiresPermissions("reportApproval:reportcondition:delete")
    public R delete(@RequestBody Integer[] ids){
		reportConditionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
